/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-27 08:43:07
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-06-05 10:52:00
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\role\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
interface RoleType {
  code: number
  msg: string
  rows: any[]
  total: number
}
export class GetSystemDictApi {
  async dictType(params: any): Promise<RoleType> {
    const result = (await service.get('/api/system/dict/type/list', {
      params
    })) as unknown as any
    return result
  }
  async EditdictType(dictData): Promise<boolean> {
    const result = (await service.put('/api/system/dict/type', dictData)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  async AdddictType(dictData): Promise<boolean> {
    const result = (await service.post('/api/system/dict/type', dictData)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  async DeletdictType(dictId: string): Promise<boolean> {
    const result = (await service.delete(`/api/system/dict/type/${dictId}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  async dictData(params: any): Promise<RoleType> {
    const result = (await service.get('/api/system/dict/data/list', {
      params
    })) as unknown as any
    return result
  }
  async EditdictData(Data): Promise<boolean> {
    const result = (await service.put('/api/system/dict/data', Data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  async AdddictData(Data): Promise<boolean> {
    const result = (await service.post('/api/system/dict/data', Data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  async DeletdictData(dictCode: string): Promise<boolean> {
    const result = (await service.delete(`/api/system/dict/data/${dictCode}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new GetSystemDictApi()
